package org.WhyMCA.Utils;

/**
@author Danilo '' Riso >> danilo DOT riso AT gmail DOT com
* @author Androidiani Dev Team
* @version 1.0
*/

import java.util.Map;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.PowerManager;
import android.preference.PreferenceManager;

/**
 * Managing config and location preferences
 * @author danilo
 *
 */

public class PreferencesMgr {

	private static PowerManager.WakeLock wl = null;
	private static SharedPreferences _shpr, _shpreferred, _shxml;
	private static SharedPreferences.Editor _shpred, _shpredpref, _shxmled;
	private final static String WhyMCA               = "xml";
			
	public static void createElements() {
		
		_shxml = Global.getCtx().getSharedPreferences(WhyMCA, 0);
		_shxmled = _shxml.edit();
				
	}
	
	public static boolean checkXmlCurrent() {
		
		if(_shxml.contains("XML_CURRENT"))
		
			return true;
		
		else 
			
			return false;
				
	}
		
	public static String getXmlCurrent() {
		
		return _shxml.getString("XML_CURRENT", null);
				
	}
			
	public static void setXmlCurrent(String s) {
		
		_shxmled.putString("XML_CURRENT", s);
		_shxmled.commit();
		
	}
		
	public static void setPubDate(String s) {
		
		_shxmled.putString("PUB_DATE", s);
		_shxmled.commit();
		
	}
	
	public static void setSoundConfig(boolean b) {
		
		_shxmled.putBoolean("NOT_SOUND", b);
		_shxmled.commit();
		
	}
	
	public static boolean getSoundConfig() {
		
		
		return _shxml.getBoolean("NOT_SOUND", false);
			
	}
	
	public static String getPubDate() {
		
		return _shxml.getString("PUB_DATE", null);
		
	}
			
}